/* Anonbar — professional, lightweight, follows the Telegram theme.
   Falls back to system colours when opened outside Telegram. */

:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --fg: var(--tg-theme-text-color, #111418);
  --hint: var(--tg-theme-hint-color, #7d8590);
  --link: var(--tg-theme-link-color, #2481cc);
  --btn: var(--tg-theme-button-color, #2481cc);
  --btn-fg: var(--tg-theme-button-text-color, #ffffff);
  --sec: var(--tg-theme-secondary-bg-color, #f3f4f6);
  --sep: rgba(127, 127, 127, 0.16);
  --press: rgba(127, 127, 127, 0.12);
  --accent-soft: color-mix(in srgb, var(--btn) 14%, transparent);
  --ad: #c27c0e;
  --r-lg: 16px;
  --r: 12px;
  --r-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171c; --fg: #f1f2f5; --hint: #8b919c; --sec: #1f2229; --btn: #5b8def; --link: #74a9ff;
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
}
body { min-height: 100vh; padding-bottom: calc(env(safe-area-inset-bottom) + 72px); }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
svg { flex: none; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 14px 16px 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.topbar .app-name { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.2px; }
.logo { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--btn); color: var(--btn-fg); font-weight: 700; font-size: 15px; }

/* Search & sort */
.search { display: block; margin: 0 16px 10px; }
#search { width: 100%; height: 40px; padding: 0 14px; border: 0; border-radius: var(--r); background: var(--sec); outline: none; font-size: 15px; }
#search::placeholder { color: var(--hint); }
#search:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.toolbar { display: flex; align-items: center; justify-content: flex-end; padding: 0 16px 10px; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--hint); }
.sort select { height: 32px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: var(--sec); cursor: pointer; outline: none; }

/* Chips (kept for future use) */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }
.chip { flex: none; height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--sec); color: var(--hint); font-size: 13px; cursor: pointer; }
.chip.on { background: var(--btn); color: var(--btn-fg); }

main { max-width: 720px; margin: 0 auto; padding: 0 0 12px; }

/* Lists */
.list { margin: 0 16px; background: var(--sec); border-radius: var(--r-lg); overflow: hidden; }
.item { position: relative; border-top: 1px solid var(--sep); }
.item:first-child { border-top: 0; }
.card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.card:active { background: var(--press); }
.card-body { flex: 1; min-width: 0; }
.card-title { display: flex; align-items: center; gap: 6px; }
.card h3 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card p { margin: 2px 0 0; font-size: 13px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--bg); color: var(--hint); }
.tag.v { color: var(--fg); font-weight: 600; }
.badge { font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 6px; background: var(--btn); color: var(--btn-fg); }
.chev { width: 16px; height: 16px; color: var(--hint); }

.item .card { padding-right: 48px; }
.fav { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--hint); display: grid; place-items: center; cursor: pointer; }
.fav svg { width: 17px; height: 17px; }
.fav.on { color: var(--ad); }
.fav.on svg { fill: currentColor; }

/* Icons */
.ic { width: 52px; height: 52px; border-radius: 13px; object-fit: cover; display: inline-grid; place-items: center; flex: none; }
.ic.xl { width: 96px; height: 96px; border-radius: 24px; }
.fallback { color: #fff; font-weight: 700; font-size: 20px; background: hsl(var(--h, 215) 65% 55%); }
.ic.xl.fallback { font-size: 36px; }

/* Ads — same row shape, clearly marked */
.card.ad { box-shadow: inset 3px 0 0 var(--ad); }
.ad-label { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--ad); }
.ad-cta { flex: none; font-size: 13px; font-weight: 600; color: var(--link); }
.ad-card { display: flex; align-items: center; gap: 12px; }
.ad-card-text { flex: 1; min-width: 0; display: grid; }
.ad-card-text h3 { margin: 0; font-size: 15px; font-weight: 600; }
.ad-card-text p { margin: 2px 0 0; font-size: 13px; color: var(--hint); }
.ad-banner { display: flex; align-items: center; gap: 12px; margin: 0 16px 12px; padding: 12px 14px; background: var(--sec); border-radius: var(--r-lg); }
.ad-banner-img, .ad-banner-fallback { width: 48px; height: 48px; border-radius: 11px; flex: none; object-fit: cover; }
.ad-banner-fallback { background: var(--sep); }
.ad-banner-text { flex: 1; min-width: 0; display: grid; }
.ad-banner-text strong { font-size: 14px; font-weight: 600; }
.ad-banner-text span:not(.ad-label) { font-size: 12px; color: var(--hint); }

/* Sections */
.section { margin: 20px 16px 0; }
.section h3 { margin: 0 0 8px 4px; font-size: 12px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: .5px; }
.section p { margin: 0; padding: 12px 14px; background: var(--sec); border-radius: var(--r-lg); font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

/* Product detail */
.back { display: inline-flex; align-items: center; gap: 4px; margin: 10px 16px 0; padding: 6px 4px; color: var(--link); font-size: 15px; white-space: nowrap; }
.back svg { width: 16px; height: 16px; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 20px 18px; text-align: center; }
.hero h2 { margin: 8px 0 0; font-size: 21px; font-weight: 700; letter-spacing: -0.3px; }
.meta { margin: 0; font-size: 13px; color: var(--hint); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.actions { display: flex; gap: 8px; margin: 2px 16px 0; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; margin: 0 16px; border: 0; border-radius: var(--r); background: var(--btn); color: var(--btn-fg); font-size: 16px; font-weight: 600; cursor: pointer; }
.actions .btn { flex: 1; margin: 0; }
.btn:active { opacity: .85; }
.btn svg { width: 18px; height: 18px; }
.btn-ghost { flex: 1; height: 44px; padding: 0 14px; border: 0; border-radius: var(--r); background: var(--sec); color: var(--btn); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.btn-ghost svg { width: 16px; height: 16px; }
.btn-ghost.on { color: var(--ad); }
.retry { display: flex; justify-content: center; padding: 16px; }
.warn { display: flex; align-items: flex-start; gap: 6px; margin: 12px 16px 0; font-size: 12px; line-height: 1.5; color: var(--hint); }
.warn svg { width: 16px; height: 16px; margin-top: 1px; }
.fine { margin: 8px 16px 0; font-size: 12px; color: var(--hint); }
.info { margin: 0; }
.info .row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--sep); font-size: 14px; }
.info .row:first-child { border-top: 0; }
.info dt { color: var(--hint); flex: none; }
.info dd { margin: 0; text-align: right; word-break: break-all; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 11px; }

/* States */
.empty { padding: 56px 16px; text-align: center; color: var(--hint); font-size: 14px; }
.empty .big { font-size: 36px; margin-bottom: 6px; }
.skeleton { display: grid; gap: 10px; padding: 8px 16px; }
.sk-row { height: 66px; border-radius: var(--r-lg); background: var(--sec); }

/* Bottom tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--bg); border-top: 1px solid var(--sep); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px; font-size: 11px; color: var(--hint); }
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--btn); font-weight: 600; }

/* Sheet */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; background: rgba(0, 0, 0, 0.4); opacity: 0; transition: opacity .2s; }
.modal.open { opacity: 1; }
.sheet { width: 100%; max-height: 85vh; overflow: auto; padding: 8px 18px calc(env(safe-area-inset-bottom) + 18px); background: var(--bg); border-radius: 18px 18px 0 0; }
.sheet-grip { width: 36px; height: 4px; margin: 4px auto 14px; border-radius: 4px; background: var(--sep); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-title { margin: 0; font-size: 17px; font-weight: 650; }
.sheet .btn { margin: 14px 0 0; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--hint); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 17px; height: 17px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 86px; z-index: 60; transform: translate(-50%, 10px); padding: 9px 16px; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Temp Mail */
.tm-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 20px 4px; text-align: center; }
.tm-icon { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--btn); }
.tm-icon svg { width: 28px; height: 28px; }
.tm-hero h2 { margin: 6px 0 0; font-size: 19px; font-weight: 700; }
.tm-hero p { margin: 0; max-width: 320px; font-size: 13px; color: var(--hint); }
.tm-expiry { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 16px 0; font-size: 13px; color: var(--hint); }
.seg { display: flex; flex-wrap: wrap; padding: 3px; border-radius: 10px; background: var(--sec); }
.seg-btn { padding: 5px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--hint); font-size: 12px; cursor: pointer; }
.seg-btn.on { background: var(--bg); color: var(--fg); font-weight: 600; }
.tm-address { display: flex; align-items: center; gap: 8px; margin: 12px 16px 0; padding: 12px 14px; border-radius: var(--r-lg); background: var(--sec); }
.tm-addr-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 14px ui-monospace, Menlo, monospace; }
.tm-timer { margin: 6px 16px 0; font-size: 12px; color: var(--hint); }
.tm-actions { display: flex; gap: 8px; margin: 12px 16px 0; }
.tm-btn { flex: 1; height: 44px; border: 0; border-radius: var(--r); background: var(--btn); color: var(--btn-fg); font-size: 14px; font-weight: 600; cursor: pointer; }
.tm-btn:disabled { opacity: .4; cursor: default; }
.tm-inbox { min-height: 72px; margin: 14px 16px 0; text-align: center; }
.tm-inbox .icon { font-size: 30px; margin: 6px 0 2px; }
.tm-empty { margin: 6px 0 0; font-size: 13px; color: var(--hint); }
.tm-msgs { list-style: none; margin: 0; padding: 0; overflow: hidden; border-radius: var(--r-lg); background: var(--sec); text-align: left; }
.tm-msgs li { border-top: 1px solid var(--sep); }
.tm-msgs li:first-child { border-top: 0; }
.tm-msg { width: 100%; display: grid; gap: 1px; padding: 12px 14px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.tm-from { font-size: 12px; color: var(--hint); }
.tm-subj { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-intro { font-size: 12px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-body { margin: 10px 0 14px; max-height: 50vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 14px; line-height: 1.6; }
.tm-history { list-style: none; margin: 0; padding: 0; overflow: hidden; border-radius: var(--r-lg); background: var(--sec); }
.tm-history li { display: flex; align-items: center; gap: 6px; padding: 10px 6px 10px 14px; border-top: 1px solid var(--sep); }
.tm-history li:first-child { border-top: 0; }
.h-main { flex: 1; min-width: 0; display: grid; }
.h-addr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 13px ui-monospace, Menlo, monospace; }
.h-date { font-size: 11px; color: var(--hint); }
.sites { display: grid; overflow: hidden; border-radius: var(--r-lg); background: var(--sec); }
.site { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-top: 1px solid var(--sep); font-size: 14px; }
.site:first-child { border-top: 0; }
.site:active { background: var(--press); }
.site-go { font-size: 12px; font-weight: 600; color: var(--link); }
