/* =========================
   TOKENS (WSPÓLNE)
   ========================= */
:root{
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 12px;

  --shadow: 0 18px 55px rgba(0, 0, 0, .35);
  --shadow2: 0 10px 25px rgba(0, 0, 0, .22);

  --accent: #ff8d00;
  --green: #9cff00;
  --blue: #61a8ff;

  --seed: var(--green);
  --leech: var(--blue);

  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
}

/* =========================
   BASE
   ========================= */
*{ box-sizing:border-box; }

html,body{
  height:100%;
  margin:0;
}

body{
  margin:0;
  font:14px/1.35 system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color: var(--text);

  /* JEDYNE tło strony (theme ustawia --page-bg) */
  background: var(--page-bg);
  background-attachment: fixed;
}

/* “grain” – lekkie, bez zewn. obrazków */
body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  mix-blend-mode: overlay;
  opacity: var(--noiseOpacity);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
}

a{ color:inherit; text-decoration:none; }

.wrap{
  max-width:1400px;
  margin:0 auto;
  padding:16px;
}

/* =========================
   TOP BAR
   ========================= */
.topbar{
  position:sticky;
  top:0;
  z-index:50;
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(0,0,0,.40), rgba(0,0,0,.12));
  border-bottom:1px solid var(--line2);
}

.topbar-inner{
  max-width:1400px;
  margin:0 auto;
  padding:12px 16px 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:900;
  letter-spacing:.6px;
  white-space:nowrap;
}
.brand .dot{
  width:10px;height:10px;border-radius:50%;
  background:var(--accent);
  box-shadow:0 0 18px rgba(255,141,0,.55);
}
.brand small{ color:var(--muted); font-weight:800; }

.actions{ display:flex; align-items:center; gap:10px; }

.btn-pill{
  border:1px solid var(--line);
  background: var(--pill);
  color: var(--text);
  border-radius:999px;
  padding:8px 12px;
  font-weight:900;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:10px;
  user-select:none;
}

.badge{
  border:1px solid rgba(255,141,0,.35);
  background: rgba(255,141,0,.16);
  border-radius:999px;
  padding:1px 8px;
  font-size:12px;
  font-weight:1000;
}

.user{
  border:1px solid var(--line);
  background: var(--pill);
  border-radius:999px;
  padding:6px 10px;
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.avatar{
  width:34px;height:34px;border-radius:12px;
  background: linear-gradient(135deg, rgba(255,141,0,.45), rgba(156,255,0,.25));
  border:1px solid var(--line2);
  flex:0 0 auto;
}
.umeta{ min-width:0; line-height:1.12; }
.umeta b{
  display:block;
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:160px;
}
.umeta span{
  display:block;
  font-size:12px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width:160px;
}

/* =========================
   MENU
   ========================= */
.menu{
  max-width:1180px;
  margin:0 auto;
  padding:0 16px 12px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.menu a{
  border:1px solid var(--line);
  background: var(--menuPill);
  color: var(--menuText);
  border-radius:999px;
  padding:8px 12px;
  font-weight:1000;
  font-size:13px;
}
.menu a.active{
  background: var(--menuActiveBg);
  border-color: var(--menuActiveBorder);
  color: var(--text);
}

/* =========================
   PANELS
   ========================= */
.panel{
  border:1px solid var(--line2);
  background: var(--panel);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

/* =========================
   ADMIN
   ========================= */
.admin{
  margin-top:14px;
  padding:14px;
  display:flex;
  align-items:stretch;
  justify-content:space-between;
  gap:14px;
  background:
    radial-gradient(1200px 260px at 30% 20%, rgba(255,141,0,.18), transparent 55%),
    radial-gradient(1200px 260px at 95% 10%, rgba(156,255,0,.10), transparent 55%),
    linear-gradient(135deg, rgba(22,18,12,.40), rgba(10,14,20,.35));
}
.admin-left{ min-width:0; flex:1 1 auto; }
.admin-title{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:1000;
  font-size:16px;
  margin:0 0 6px;
}
.tag{
  border:1px solid rgba(255,141,0,.35);
  background: rgba(255,141,0,.16);
  border-radius:999px;
  padding:2px 10px;
  font-size:12px;
  font-weight:1000;
}
.admin-left ul{
  margin:0;
  padding-left:18px;
  color: var(--muted);
  font-size:13px;
}
.admin-right{
  flex:0 0 auto;
  display:grid;
  grid-template-columns:repeat(3, minmax(90px, 1fr));
  gap:10px;
  min-width:320px;
  align-content:start;
}
.mini{
  border:1px solid var(--line2);
  background: var(--panel3);
  border-radius: var(--r-md);
  padding:10px;
}
.mini .k{ color:var(--muted); font-size:12px; }
.mini .v{ font-size:18px; font-weight:1000; margin-top:2px; }

/* =========================
   CATEGORIES
   ========================= */
.cats{
  margin-top:14px;
  padding:10px;
  display:flex;
  gap:10px;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}
.cats a{
  flex:0 0 auto;
  border:1px solid var(--line2);
  background: var(--pill2);
  border-radius:999px;
  padding:8px 12px;
  font-weight:1000;
  font-size:13px;
  color: var(--muted);
  display:flex;
  align-items:center;
  gap:8px;
}
.cats a.active{
  background: rgba(156,255,0,.13);
  border-color: rgba(156,255,0,.35);
  color: var(--text);
}

/* =========================
   SEARCH
   ========================= */
.search{
  margin-top:14px;
  padding:10px;
  display:flex;
  gap:10px;
  align-items:center;
}
.search input{
  flex:1 1 auto;
  min-width:0;
  border:1px solid var(--line2);
  background: var(--input);
  color: var(--text);
  border-radius:999px;
  padding:12px 14px;
  outline:none;
}
.seg{
  border:1px solid var(--line2);
  background: var(--pill2);
  color: var(--muted);
  border-radius:999px;
  padding:9px 12px;
  font-weight:1000;
  font-size:12px;
  cursor:pointer;
  user-select:none;
}
.seg.active{
  background: rgba(255,141,0,.16);
  border-color: rgba(255,141,0,.35);
  color: var(--text);
}
.search button{
  border:0;
  background: var(--accent);
  color:#111;
  border-radius:999px;
  padding:12px 16px;
  font-weight:1000;
  cursor:pointer;
  white-space:nowrap;
}

/* =========================
   GRID
   ========================= */
.grid{
  margin-top:14px;
  display:grid;
  grid-template-columns: 1fr 360px;
  gap:14px;
  align-items:start;
}
/* KLUCZ: żeby karuzela nie rozpychała grida */
.grid > *{ min-width:0; }

.section{ padding:12px; min-width:0; }
.panel.section{ overflow:hidden; } /* KLUCZ przy wielu kartach */

.head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.head h2{ margin:0; font-size:15px; font-weight:1000; }
.head a{
  border:1px solid var(--line2);
  background: var(--pill2);
  border-radius:999px;
  padding:8px 12px;
  color: var(--muted);
  font-weight:1000;
  font-size:13px;
}

/* =========================
   CAROUSEL
   ========================= */
.carouselWrap{
  position:relative;
  overflow:hidden;
  border-radius: var(--r-md);
  min-width:0;
}
.carousel{
  display:flex;
  gap:12px;
  padding: 6px 60px;
  overflow-x:auto;
  overflow-y:hidden;
  scroll-snap-type:x mandatory;
  scroll-padding: 0 60px;
  -webkit-overflow-scrolling:touch;
  max-width:100%;
  min-width:0;
  flex-wrap:nowrap;
  scrollbar-width:none;
}
.carousel::-webkit-scrollbar{ display:none; }

.carouselWrap::before,
.carouselWrap::after{
  content:"";
  position:absolute;
  top:0; bottom:0;
  width:72px;
  z-index:5;
  pointer-events:none;
}
.carouselWrap::before{
  left:0;
  background: linear-gradient(90deg, var(--fadeBg), rgba(0,0,0,0));
}
.carouselWrap::after{
  right:0;
  background: linear-gradient(270deg, var(--fadeBg), rgba(0,0,0,0));
}

.carouselNav{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  z-index:6;
  width:38px;height:38px;
  border-radius:999px;
  border:1px solid var(--line2);
  background: color-mix(in srgb, var(--fadeBg) 70%, transparent);
  color: var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  pointer-events:auto;
  backdrop-filter: blur(10px);
}
.carouselNav:hover{ filter:brightness(1.06); }
.carouselNav.prev{ left:8px; }
.carouselNav.next{ right:8px; }

.posterCard{
  width:148px;
  flex:0 0 auto;
  border:1px solid var(--line2);
  background: var(--panel2);
  border-radius: var(--r-md);
  overflow:hidden;
  box-shadow: var(--shadow2);
  scroll-snap-align:start;
}
.posterCard img{
  width:100%;
  height:200px;
  object-fit:cover;
  display:block;
  background:#0b0f14;
}
.pm{ padding:9px 10px; }
.pm .t{
  font-weight:1000;
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.pm .sl{
  display:flex;
  justify-content:space-between;
  margin-top:6px;
  font-size:12px;
  color: var(--muted);
  font-weight:900;
}
.seed{ color: var(--seed); font-weight:1000; }
.leech{ color: var(--leech); font-weight:1000; }

/* =========================
   LIST
   ========================= */
.list{ display:grid; gap:10px; }

.row{
  border:1px solid var(--line2);
  background: var(--panel2);
  border-radius: var(--r-md);
  padding:10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.row .left{ min-width:0; }
.row .name{
  font-weight:1000;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.row .sub{
  margin-top:2px;
  font-size:12px;
  color: var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.row .right{
  display:flex;
  gap:10px;
  align-items:center;
  flex:0 0 auto;
  font-weight:1000;
  color: var(--muted);
}
.pillMini{
  border:1px solid var(--line2);
  background: var(--pill2);
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  font-weight:1000;
  white-space:nowrap;
}

.side .section{ margin-bottom:14px; }
.side .section:last-child{ margin-bottom:0; }

/* =========================
   SHOUTBOX + FOOTER
   ========================= */
.shout{ margin-top:14px; padding:12px; }

.msgs{
  display:grid;
  gap:8px;
  max-height:320px;
  overflow:auto;
  padding-right:4px;
}
.msg{
  border:1px solid var(--line2);
  background: var(--panel2);
  border-radius: var(--r-md);
  padding:10px 12px;
}
.msg b{ display:block; }
.msg span{
  display:block;
  margin-top:4px;
  color: var(--muted);
  font-size:12px;
}

.shForm{
  margin-top:10px;
  display:flex;
  gap:10px;
}
.shForm input{
  flex:1 1 auto;
  min-width:0;
  border:1px solid var(--line2);
  background: var(--input);
  color: var(--text);
  border-radius:999px;
  padding:11px 12px;
  outline:none;
}
.shForm button{
  border:1px solid var(--line2);
  background: var(--pill2);
  color: var(--text);
  border-radius:999px;
  padding:11px 14px;
  font-weight:1000;
  cursor:pointer;
  white-space:nowrap;
}

footer{
  margin-top:14px;
  border-top:1px solid var(--line2);
  padding:12px 0 6px;
  color: var(--muted);
  font-size:12px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.fLinks{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.fLinks a{
  border:1px solid var(--line2);
  background: var(--pill2);
  border-radius:999px;
  padding:6px 10px;
  font-weight:1000;
}

/* =========================
   RESPONSIVE
   ========================= */
.hamb{ display:none; }
.drawerBackdrop, .drawer{ display:none; }

@media (max-width:980px){
  .grid{ grid-template-columns:1fr; }
  .admin{ flex-direction:column; }
  .admin-right{
    grid-template-columns:repeat(3,1fr);
    min-width:0;
  }
}

@media (max-width:820px){
  .menu{ display:none; }
  .hamb{ display:flex; }
  .admin-right{ grid-template-columns:1fr; }

  .search{
    flex-direction:column;
    align-items:stretch;
  }
  .search button{ width:100%; }

  .actions{ gap:8px; }
  .umeta b, .umeta span{ max-width:110px; }

  .drawerBackdrop, .drawer{ display:block; }
}

/* =========================
   MOBILE DRAWER
   ========================= */
.drawerBackdrop{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  display:none;
  z-index:80;
}
.drawer{
  position:fixed;
  top:0; left:0;
  width:320px;
  max-width:86vw;
  height:100%;
  background: var(--panel);
  border-right:1px solid var(--line2);
  box-shadow: var(--shadow);
  transform:translateX(-105%);
  transition:transform .22s ease;
  z-index:90;
  padding:14px;
  overflow:auto;
  backdrop-filter: blur(12px);
}
.drawer.open{ transform:translateX(0); }
.drawerBackdrop.open{ display:block; }

.dTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.dTitle{ font-weight:1000; }
.dSec{
  margin:10px 0 6px;
  color: var(--muted);
  font-size:12px;
  font-weight:1000;
  letter-spacing:.2px;
}
.drawer a{
  display:flex;
  align-items:center;
  justify-content:space-between;
  border:1px solid var(--line2);
  background: var(--pill2);
  border-radius:12px;
  padding:10px 12px;
  margin-bottom:10px;
  font-weight:1000;
}
