/* Telegram Mini App – UI (single stylesheet)
   Theme can be overridden by assets/app.js using Telegram themeParams.
*/

:root{
  --bg:#0f1115;
  --surface:#191c22;
  --surface2:#121722;
  --text:#e8ecf1;
  --muted:#9aa4b2;
  --border:#232a34;
  --accent:#3ba7ff;
  --danger:#cc2233;
  --success:#2ecc71;

  --radius:18px;
  --radius-sm:12px;
  --shadow:0 10px 30px rgba(0,0,0,.28);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
html{color-scheme:dark light;background:var(--bg)}
body{
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  min-height:100vh;
  overflow-x:hidden;
  position:relative;
  isolation:isolate;
  overscroll-behavior-y:none;
}

/* Ambient animated decor (lightweight, GPU-friendly) */
@media (prefers-reduced-motion: no-preference){
  body::before, body::after{
    content:"";
    position:fixed;
    width:520px;
    height:520px;
    border-radius:999px;
    filter:blur(70px);
    opacity:.26;
    z-index:-1;
    pointer-events:none;
    transform:translate3d(0,0,0);
  }
  body::before{
    left:-160px;
    top:-200px;
    background:radial-gradient(circle at 35% 35%, rgba(59,167,255,.70), rgba(59,167,255,0) 60%);
    animation:blobFloat1 16s ease-in-out infinite;
  }
  body::after{
    right:-200px;
    bottom:-240px;
    background:radial-gradient(circle at 35% 35%, rgba(46,204,113,.55), rgba(46,204,113,0) 60%);
    animation:blobFloat2 20s ease-in-out infinite;
  }
}
@keyframes blobFloat1{
  0%,100%{transform:translate3d(0,0,0) scale(1)}
  50%{transform:translate3d(90px,130px,0) scale(1.08)}
}
@keyframes blobFloat2{
  0%,100%{transform:translate3d(0,0,0) scale(1)}
  50%{transform:translate3d(-120px,-110px,0) scale(1.10)}
}

img,video{max-width:100%;height:auto}
a{color:inherit}
button,input{font-family:inherit}

:focus-visible{outline:2px solid rgba(59,167,255,.8);outline-offset:2px}

.page{
  padding-left:calc(12px + var(--safe-left));
  padding-right:calc(12px + var(--safe-right));
}

/* Top / brand */
.appbar{
  position:sticky;
  top:0;
  z-index:20;
  padding:calc(10px + var(--safe-top)) 16px 12px;
  background:rgba(15,17,21,.86);
  backdrop-filter:blur(12px) saturate(1.35);
  border-bottom:1px solid rgba(255,255,255,.06);
}
.appbar::after{
  content:"";
  position:absolute;
  left:-35%;
  right:-35%;
  bottom:-1px;
  height:1px;
  background:linear-gradient(90deg, rgba(59,167,255,0), rgba(59,167,255,.55), rgba(46,204,113,.35), rgba(59,167,255,0));
  opacity:.55;
  animation:shimmerLine 6s ease-in-out infinite;
  pointer-events:none;
}
@keyframes shimmerLine{
  0%,100%{transform:translateX(-20%)}
  50%{transform:translateX(20%)}
}
.appbar-row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.brand{display:flex;align-items:center;gap:12px}
.brand-logo{
  width:44px;
  height:44px;
  border-radius:14px;
  object-fit:cover;
  background:#0b0e13;
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 8px 24px rgba(0,0,0,.25);
}

@media (prefers-reduced-motion: no-preference){
  .brand-logo{animation:logoBob 6s ease-in-out infinite}
}
@keyframes logoBob{
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-2px)}
}

.brand-title{font-weight:900;letter-spacing:.2px;font-size:16px;line-height:1.1}
.brand-sub{color:var(--muted);font-weight:700;font-size:12px;margin-top:3px}

.title{font-weight:900;letter-spacing:.2px;font-size:16px}
.icon-btn{
  background:var(--surface2);
  border:1px solid rgba(255,255,255,.08);
  color:var(--text);
  width:40px;
  height:40px;
  border-radius:14px;
  display:grid;
  place-items:center;
  cursor:pointer;
  transition:transform .16s ease, background .16s ease, border-color .16s ease;
}
@media (hover:hover){
  .icon-btn:hover{border-color:rgba(59,167,255,.35);background:rgba(255,255,255,.04)}
}
.icon-btn:active{transform:scale(.97)}

.hero{position:relative;padding:16px 0 4px;overflow:hidden}
.hero::before{
  content:"";
  position:absolute;
  inset:-35% -20% auto -20%;
  height:220px;
  background-image:url('../logo.png');
  background-size:140px 140px;
  background-repeat:repeat;
  background-position:center;
  filter:blur(12px) opacity(.14);
  transform:scale(1.2);
  pointer-events:none;
  animation:heroLogoDrift 26s linear infinite;
  will-change:background-position;
}
.hero::after{
  content:"";
  position:absolute;
  inset:-55% -25% auto -25%;
  height:300px;
  background:
    radial-gradient(circle at 20% 40%, rgba(59,167,255,.35), transparent 55%),
    radial-gradient(circle at 75% 30%, rgba(46,204,113,.22), transparent 60%),
    radial-gradient(circle at 55% 70%, rgba(255,255,255,.06), transparent 60%);
  filter:blur(16px);
  opacity:.95;
  pointer-events:none;
  animation:heroGlow 10s ease-in-out infinite;
}
@keyframes heroLogoDrift{
  0%{background-position:0 0}
  100%{background-position:180px 260px}
}
@keyframes heroGlow{
  0%,100%{transform:translate3d(0,0,0) scale(1);opacity:.75}
  50%{transform:translate3d(60px,40px,0) scale(1.06);opacity:.95}
}

/* Filters */
.filters{display:grid;grid-template-columns:1fr;gap:10px;padding:12px 0}
.filter-row{display:flex;gap:10px;align-items:center}
.chip-btn{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(18,23,34,.9);
  color:var(--text);
  font-weight:800;
  cursor:pointer;
  transition:transform .16s ease, border-color .16s ease, background .16s ease;
}
@media (hover:hover){
  .chip-btn:hover{border-color:rgba(59,167,255,.22);background:rgba(255,255,255,.04)}
}
.chip-btn:active{transform:scale(.98)}
.chip-btn small{color:var(--muted);font-weight:700}
.search{
  flex:1 1 auto;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(18,23,34,.9);
  transition:border-color .18s ease, box-shadow .18s ease, background .18s ease, transform .18s ease;
}
.search:focus-within{
  border-color:rgba(59,167,255,.38);
  box-shadow:0 0 0 4px rgba(59,167,255,.12);
  background:rgba(255,255,255,.03);
}
.search input{
  width:100%;
  border:none;
  background:transparent;
  color:var(--text);
  outline:none;
  font-weight:700;
}
.search .k{color:var(--muted);font-weight:900}

/* Grid + cards */
.grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:14px;
  padding:8px 0 calc(92px + var(--safe-bottom));
}
@media (min-width:780px){.grid{grid-template-columns:repeat(3,1fr)}}

.card{
  position:relative;
  display:block;
  text-decoration:none;
  color:inherit;
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0) 55%), var(--surface);
  border:1px solid rgba(255,255,255,.06);
  border-radius:var(--radius);
  overflow:hidden;
  box-shadow:var(--shadow);
  transform:translateZ(0);
  transition:transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card::after{
  content:"";
  position:absolute;
  inset:-40% -30% auto -30%;
  height:220px;
  background:radial-gradient(circle at 50% 50%, rgba(59,167,255,.18), transparent 60%);
  opacity:0;
  transform:translate3d(0,-10px,0);
  transition:opacity .22s ease, transform .22s ease;
  pointer-events:none;
}
@media (hover:hover){
  .card:hover{transform:translateY(-3px);border-color:rgba(59,167,255,.22);box-shadow:0 14px 40px rgba(0,0,0,.38)}
  .card:hover::after{opacity:1;transform:translate3d(0,0,0)}
}
.card:active{transform:scale(.985)}
.card-media{
  width:100%;
  aspect-ratio:4/3;
  background:#0b0e13;
  display:block;
  object-fit:cover;
}
.card-body{padding:12px}
.card-title{font-weight:900;line-height:1.2}
.card-sub{
  margin-top:4px;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

/* Detail */
.back{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin:12px 0 8px;
  text-decoration:none;
  color:rgba(156,195,255,1);
  font-weight:900;
}

.detail{
  padding:12px 0 calc(92px + var(--safe-bottom));
  max-width:860px;
  margin:0 auto;
}
.detail h1{margin:6px 0 4px;font-size:22px;letter-spacing:.1px}
.detail .desc{color:var(--muted);line-height:1.55;font-size:15px;margin:10px 0 16px}

.slider{
  position:relative;
  border-radius:var(--radius);
  overflow:hidden;
  border:1px solid var(--border);
  background:#0b0e13;
  box-shadow:var(--shadow);
}
.slides{display:flex;transition:transform .35s ease;will-change:transform}
.slides > *{min-width:100%;max-height:70vh;object-fit:cover}

.slider-btn{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  background:rgba(0,0,0,.45);
  border:1px solid rgba(255,255,255,.12);
  color:#fff;
  width:44px;
  height:44px;
  border-radius:999px;
  display:grid;
  place-items:center;
  cursor:pointer;
  user-select:none;
}
.slider-btn:active{transform:translateY(-50%) scale(.98)}
.slider-btn.prev{left:10px}
.slider-btn.next{right:10px}

.dots{text-align:center;margin:10px 0 2px}
.dot{
  display:inline-block;
  width:8px;
  height:8px;
  margin:5px 4px;
  background:rgba(255,255,255,.18);
  border-radius:999px;
  cursor:pointer;
}
.dot.active{background:var(--accent)}

.chips{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}
.chip{
  background:var(--surface2);
  border:1px solid var(--border);
  padding:8px 12px;
  border-radius:999px;
  cursor:pointer;
  user-select:none;
  color:var(--text);
  font-weight:800;
}
.chip b{margin-left:6px}
.chip.active{border-color:rgba(59,167,255,.7);box-shadow:0 0 0 2px rgba(59,167,255,.18) inset}

.cta{
  display:block;
  text-align:center;
  background:var(--accent);
  color:white;
  text-decoration:none;
  padding:14px;
  border-radius:14px;
  font-weight:900;
}

/* Bottom tabs */
.tabs{
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  z-index:40;
  background:rgba(15,17,21,.90);
  backdrop-filter:blur(14px) saturate(1.35);
  border-top:1px solid rgba(255,255,255,.06);
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:8px;
  padding:10px calc(12px + var(--safe-right)) calc(10px + var(--safe-bottom)) calc(12px + var(--safe-left));
}

.tabs::before{content:"";position:absolute;left:-35%;right:-35%;top:0;height:1px;background:linear-gradient(90deg, rgba(59,167,255,0), rgba(59,167,255,.45), rgba(46,204,113,.25), rgba(59,167,255,0));opacity:.45;animation:shimmerLine 7s ease-in-out infinite;pointer-events:none}
.tab{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:10px 6px;
  border-radius:14px;
  border:1px solid transparent;
  color:var(--muted);
  text-decoration:none;
  font-weight:900;
  font-size:12px;
  transition:transform .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
  will-change:transform;
}
.tab .icon{font-size:18px;line-height:0;transition:transform .16s ease}
.tab:active{transform:scale(.97)}
@media (hover:hover){
  .tab:hover{background:rgba(255,255,255,.04)}
  .tab:hover .icon{transform:translateY(-1px)}
}
.tab.active{background:rgba(255,255,255,.04);border-color:rgba(59,167,255,.22);color:var(--text)}
.tab.active .icon{transform:translateY(-1px) scale(1.03)}

.sheet-open{overflow:hidden}

/* Bottom sheets */
.sheet{position:fixed;inset:0;z-index:50;opacity:0;pointer-events:none;transition:opacity 160ms ease}
.sheet.open{opacity:1;pointer-events:auto}
.scrim{position:absolute;inset:0;background:rgba(0,0,0,.58);opacity:0;transition:opacity 160ms ease}
.sheet.open .scrim{opacity:1}
.panel{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0) 55%), var(--surface);
  border:0;
  border-top-left-radius:var(--radius);
  border-top-right-radius:var(--radius);
  max-height:82vh;
  overflow:auto;
  padding:18px 18px calc(18px + var(--safe-bottom));
  box-shadow:0 -26px 70px rgba(0,0,0,.62);
  opacity:0;
  transform:translateY(18px);
  transition:transform 240ms cubic-bezier(.2,.9,.2,1), opacity 240ms ease;
  overscroll-behavior:contain;
}
.sheet.open .panel{opacity:1;transform:translateY(0)}
.panel::-webkit-scrollbar{width:0;height:0}
.panel::before{
  content:"";
  display:block;
  width:56px;
  height:6px;
  border-radius:999px;
  background:rgba(255,255,255,.18);
  margin:2px auto 12px;
}
.panel h3{margin:0 0 10px;font-size:16px;letter-spacing:.2px}
.panel p{color:rgba(231,236,241,.92);margin:10px 0}
.panel a{color:rgba(59,167,255,.95);text-decoration:none;font-weight:900}


/* Cleaner categories list (removes grey bars) */
#sheetCats .sheet-links{
  gap:0;
  margin-top:10px;
  background:rgba(255,255,255,.02);
  border-radius:16px;
  overflow:hidden;
}
#sheetCats .sheet-links a{
  border:0;
  background:transparent;
  border-radius:0;
  padding:14px 12px;
}
#sheetCats .sheet-links a + a{border-top:1px solid rgba(255,255,255,.06)}
#sheetCats .sheet-links a:active{background:rgba(255,255,255,.04)}
#sheetCats .sheet-links a.active{background:rgba(59,167,255,.12)}

/* Links list inside sheets */
.sheet-links{display:grid;gap:10px;margin-top:12px}
.sheet-links a{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:var(--surface2);
  color:var(--text);
}
.sheet-links a:active{transform:scale(.99)}
.sheet-links a.active{border-color:rgba(59,167,255,.55)}
.close{
  position:sticky;
  top:0;
  margin:-8px -8px 10px auto;
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--surface2);
  color:var(--text);
  cursor:pointer;
  font-weight:900;
}

/* Admin styles (simple) */
.admin-wrap{padding:0 0 calc(92px + var(--safe-bottom));max-width:980px;margin:0 auto}
.admin-nav{display:flex;flex-wrap:wrap;gap:8px;padding:12px 0}
.admin-nav a{padding:10px 12px;border-radius:999px;border:1px solid var(--border);background:var(--surface2);color:var(--text);text-decoration:none;font-weight:900}
.admin-nav a.active{border-color:rgba(59,167,255,.55);box-shadow:0 0 0 2px rgba(59,167,255,.16) inset}

.admin-wrap input,.admin-wrap textarea,.admin-wrap select{
  width:100%;
  padding:10px 12px;
  border-radius:var(--radius-sm);
  border:1px solid var(--border);
  background:var(--surface2);
  color:var(--text);
  font-weight:700;
  margin:6px 0;
}
.admin-wrap textarea{min-height:110px;resize:vertical}
.admin-wrap button{padding:10px 12px;border:none;border-radius:12px;background:var(--accent);color:#fff;font-weight:900;cursor:pointer}
.admin-wrap button[type="button"]{background:var(--surface2);border:1px solid var(--border);color:var(--text)}
.form{padding:12px;margin:12px 0;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius)}
.form input,.form textarea,.form select{
  width:100%;
  padding:10px 12px;
  border-radius:var(--radius-sm);
  border:1px solid rgba(255,255,255,.08);
  background:var(--surface2);
  color:var(--text);
  font-weight:700;
}
.form textarea{min-height:110px;resize:vertical}
.btn{padding:10px 12px;border:none;border-radius:12px;background:var(--accent);color:#fff;font-weight:900;cursor:pointer}
.btn.secondary{background:var(--surface2);border:1px solid var(--border);color:var(--text)}
.btn.danger{background:var(--danger)}

.alert{margin:12px 0;padding:10px 12px;border-radius:14px;border:1px solid var(--border);background:var(--surface2);font-weight:800}
.alert.success{border-color:rgba(46,204,113,.55)}
.alert.error{border-color:rgba(204,34,51,.55)}

.hidden{display:none !important}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{scroll-behavior:auto !important;transition:none !important;animation:none !important}
}
@media (prefers-reduced-motion: no-preference){
  .grid .card{animation:cardIn .52s cubic-bezier(.2,.85,.2,1) both}
  .grid .card:nth-child(1){animation-delay:.02s}
  .grid .card:nth-child(2){animation-delay:.05s}
  .grid .card:nth-child(3){animation-delay:.08s}
  .grid .card:nth-child(4){animation-delay:.11s}
  .grid .card:nth-child(5){animation-delay:.14s}
  .grid .card:nth-child(6){animation-delay:.17s}
  .grid .card:nth-child(7){animation-delay:.20s}
  .grid .card:nth-child(8){animation-delay:.23s}
  .grid .card:nth-child(9){animation-delay:.26s}
  .grid .card:nth-child(10){animation-delay:.29s}
  .grid .card:nth-child(11){animation-delay:.32s}
  .grid .card:nth-child(12){animation-delay:.35s}
}
@keyframes cardIn{
  from{opacity:0;transform:translateY(10px)}
  to{opacity:1;transform:translateY(0)}
}


