:root {
  --bg: #e9f0ff;
  --card: #12131a;
  --muted: #000;
  --text: #000;
  --ring: rgba(79,140,255,0.35);
  --border: #3399ff;
  --chip: #3399ff;
  --chip-active: #3300cc;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 14px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
a { color: inherit; text-decoration: none; }

/* Layout Ä‘á»ƒ footer dÃ­nh Ä‘Ã¡y */
body { min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Header */
.header {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(180deg, rgba(43,125,225,0.9), rgba(43,125,225,0.6), rgba(43,125,225,0));
  backdrop-filter: blur(6px);
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  display: flex; flex-direction: row; align-items: center; gap: 10px;
}
.brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand .dot { width: 10px; height: 10px; background: radial-gradient(circle at 30% 30%, #8ab4f8, #4f8cff); border-radius: 999px; box-shadow: 0 0 0 4px var(--ring); }
.sub { color: var(--muted); font-weight: 500; font-size: 13px; margin-top: 2px; }

/* Chipbar */
.chipbar { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { padding: 8px 12px; border-radius: 999px; background: var(--chip); border: 1px solid var(--border); color: #fff; cursor: pointer; transition: 0.2s; white-space: nowrap; }
.chip:hover { background: #1e2538; }
.chip.active { background: var(--chip-active); color: #cfe1ff; border-color: #3399ff; }

/* Grid báº±ng Flexbox: cá»‘ Ä‘á»‹nh bá» rá»™ng tháº» & cÄƒn giá»¯a */
.grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;   /* cÄƒn giá»¯a cáº£ dÃ£y tháº» */
  gap: 16px;                 /* khoáº£ng cÃ¡ch giá»¯a tháº» */
  margin-top: 20px;
}

/* Card */
.card {
  width: 260px;              /* cá»‘ Ä‘á»‹nh bá» rá»™ng tháº» */
  display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.00));
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 8px 20px rgba(0,0,0,0.18);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,0.28); border-color: #283149; }
.thumb { aspect-ratio: 16/9; background: #0f1320; display: grid; place-items: center; }
.thumb .ph { width: 40%; height: 40%; border-radius: 12px; background: linear-gradient(135deg, #1d2540, #11162a); border: 1px dashed #2b3555; }
.body { padding: 12px; display: grid; gap: 6px; }
.title { font-weight: 700; }
.desc { color: var(--muted); font-size: 13px; min-height: 36px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; color: #cfe1ff; background: #1b2236; border: 1px solid #2a3550; border-radius: 999px; padding: 3px 8px; }
.row { display: flex; gap: 8px; align-items: center; }

.btn { flex: 1; text-align: center; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; transition: transform .08s ease, border-color .15s ease, background .15s ease; }
.btn:hover { border-color: #2a3550; background: #121728; }
.btn.primary { background: linear-gradient(180deg, #2a63ff, #365bdb); border-color: #3a60ee; color: #fff; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }

/* Footer cá»‘ Ä‘á»‹nh Ä‘Ã¡y trang */
footer.footer {
  background: #e9f0ff;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid #3399ff;
  padding: 30px 0;
  margin-top: 24px;
}
.footer h3 { color: #4f8cff; margin: 0 0 10px 0; }
.footer .socials { display: flex; justify-content: center; gap: 20px; margin-bottom: 8px; }
.footer .socials a { color: #000; text-decoration: none; transition: color 0.2s; }
.footer .socials a:hover { color: #4f8cff; }
.footer p { font-size: 12px; color: var(--muted); margin: 0; }

/* Thá»‘ng kÃª truy cáº­p */
#counter-wrap {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 14px;
}
#counter-wrap span {
  color: #4f8cff;
  font-weight: 600;
}




/* ==== HÃ ng nÃºt: luÃ´n 2 nÃºt báº±ng nhau, khÃ´ng trÃ n ==== */
.row{
  display:flex;
  gap:8px;
  justify-content:center;
  align-items:stretch;           /* Ä‘á»ƒ 2 nÃºt cao báº±ng nhau */
  width:100%;
}
.row > *{
  flex:1 1 0;                   /* chia Ä‘á»u */
  min-width:0;                  /* ngÄƒn trÃ n */
}

/* Host cá»§a web-component: KHÃ”NG chiáº¿m box Ä‘á»ƒ khá»i lá»‡ch layout */
.row > esp-web-install-button.inline-install{
  display: contents;            /* cho nÃºt slotted Ä‘á»©ng trá»±c tiáº¿p trong .row */
}

/* áº¨n Táº¤T Cáº¢ UI máº·c Ä‘á»‹nh bÃªn trong component Ä‘á»ƒ khÃ´ng hiá»‡n "Connect" hay progress */
esp-web-install-button::part(default),
esp-web-install-button::part(activate-button),
esp-web-install-button::part(button),
esp-web-install-button::part(install-progress),
esp-web-install-button::part(link){
  display: none !important;
}

/* NÃºt dáº¡ng <button>/<a> cá»§a mÃ¬nh (slotted) â€” Ä‘á»“ng bá»™ kÃ­ch thÆ°á»›c */
.row .btn{
  display:flex; align-items:center; justify-content:center;
  height:40px; width:100%;      /* full bá» rá»™ng cá»§a cá»™t flex */
  padding:0 16px;
  font-weight:600; font-size:14px; line-height:1; letter-spacing:.2px;
  box-sizing:border-box;
  border-radius:10px;
  white-space:nowrap;           /* trÃ¡nh xuá»‘ng dÃ²ng vá»¡ nÃºt */
  overflow:hidden;              /* Ä‘á» phÃ²ng text dÃ i */
  text-overflow:ellipsis;
}

/* ==== NÃºt Náº¡p FW (xanh pháº³ng) ==== */
.btn.fw{
  background:#3399ff;
  border:1px solid #3399ff;
  color:#fff;
  transition: background .15s ease, border-color .15s ease;
}
.btn.fw:hover{ background:#2a83ff; border-color:#226eea; }
.btn.fw:active{ background:#1a66e0; }

/* Tráº¡ng thÃ¡i bá»‹ khoÃ¡/xÃ¡m */
.btn.disabled{ cursor:not-allowed; pointer-events:none; }
.btn.fw.disabled{ background:#1b2533; border-color:#2b3444; color:#8c95a6; }

/* NÃºt "Xem sÆ¡ Ä‘á»“" (ghost) */
.btn.ghost{
  border:1px solid #2c3140;
  color:#000;
  background:transparent;
  transition: all .2s ease;
}
.btn.ghost:hover{
  background:rgba(255,255,255,.05);
  border-color:#3a4255;
}

/* Anchor dáº¡ng nÃºt: xoÃ¡ underline & outline */
a.btn{ text-decoration:none !important; outline:none; }
a.btn:focus{ outline:none; }

/* --- Chá»‘ng trÃ n ná»™i dung trong tháº» (náº¿u mÃ´ táº£ dÃ i) --- */
.card .title{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.card .desc{
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;         /* giá»›i háº¡n 2 dÃ²ng */
  -webkit-box-orient:vertical;
}

.btn.disabled,
.btn.fw.disabled,
.btn.ghost.disabled{
  background:#1a1e26 !important;
  border-color:#2b3444 !important;
  color:#7e8798 !important;
  cursor:not-allowed;
  pointer-events:none;
}

.card { --thumb-h: 140px; }  /* Chiá»u cao cá»‘ Ä‘á»‹nh vÃ¹ng áº£nh */

.card .thumb {
  display: flex;
  align-items: center;        /* CÄƒn giá»¯a dá»c */
  justify-content: center;    /* CÄƒn giá»¯a ngang */
  height: var(--thumb-h);
  border-radius: 12px;
  overflow: hidden;
  background: #3399ff;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.card .thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;        /* Giá»¯ Ä‘Ãºng tá»‰ lá»‡, khÃ´ng bá»‹ cáº¯t */
  display: block;
}

/* ==== Viewer full-width á»Ÿ trÃªn lÆ°á»›i tháº» ==== */
.viewer { width: 100%; margin: 10px 0 18px; }
.viewer.hidden { display: none; }
.viewer .card.full { width: 100%; }

/* Thanh Ä‘iá»u khiá»ƒn cá»§a viewer (khÃ´ng cÃ²n tiÃªu Ä‘á») */
.viewer .viewer-bar {
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0));
}


.viewer .viewer-title {
  font-weight: 700;
  color: #cfe1ff;
}

/* áº¢nh trong viewer chiáº¿m full bá» rá»™ng tháº» */
.viewer .media { width: 100%; background: #0f1320; }
.viewer .media img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.viewer .viewer-bar {
  display: flex;
  justify-content: center;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0));
}


.viewer .viewer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr; /* chia Ä‘Ã´i Ä‘á»u */
  gap: 10px;
  width: 100%;
  max-width: 500px; /* Ä‘á»ƒ giá»¯a, khÃ´ng quÃ¡ rá»™ng náº¿u mÃ n to */
}

/* Tráº¡ng thÃ¡i nÃºt vÃ´ hiá»‡u (khi khÃ´ng cÃ³ PDF) */
.btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.viewer .viewer-actions .btn {
  width: 100%;
  text-align: center;
  padding: 10px 0;
  font-weight: 600;
  border-radius: 8px;
}

/* KhÃ³a nÃºt "Xem sÆ¡ Ä‘á»“" khi khÃ´ng cÃ³ áº£nh */
a.view-link.disabled {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(40%);
}

.brand-logo {
  max-width: 60px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ===== Modal má»i vÃ o group ===== */
.hidden { display: none !important; }

.modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative; z-index: 1;
  width: min(560px, calc(100% - 36px));
  background: #111520;
  border: 1px solid #2a2f45;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.03) inset;
  padding: 22px 20px;
  color: var(--text);
}
.modal-close {
  position: absolute; right: 10px; top: 10px;
  width: 34px; height: 34px; border-radius: 999px;
  border: 1px solid #3a405a; background: #1a1f2e; color: #fff;
  cursor: pointer; font-weight: 700;
}
.modal-close:hover { filter: brightness(1.06); }

.modal-head { text-align: center; margin-top: 6px; margin-bottom: 12px; }
.modal-head .emoji { font-size: 26px; margin-bottom: 6px; }
.modal-head .title { font-weight: 800; font-size: 20px; color: #ffd27d; }
.modal-head .subtitle { color: #cfe1ff; opacity: .9; margin-top: 6px; }

.modal-body {
  color: var(--muted);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  border: 1px dashed #2f3a5a;
  padding: 12px; border-radius: 12px; margin: 12px 0 16px;
}

.modal-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.modal-actions .btn { height: 42px; }


/* Khi chá»‰ cÃ³ 1 nÃºt (class .single) thÃ¬ cÄƒn giá»¯a */
.modal-actions.single {
  display: flex;
  justify-content: center;
}
.modal-actions.single .btn {
  width: 160px;
}

.modal-body {
  text-align: center;
  line-height: 1.6;
  font-size: 14px;
}

