/* AIO Topics V4 — scoped additions, preserve navigation and existing AIO theme. */
.aio-topics-v4{padding:clamp(15px,2vw,24px);margin-bottom:16px;border-color:rgb(var(--orbit-p4-line, 50 106 123));background:linear-gradient(155deg,rgb(var(--orbit-p4-panel, 11 48 64)),rgb(var(--orbit-p4-panel, 9 37 49)))}
.aio-topics-head{display:flex;align-items:center;justify-content:space-between;gap:15px;flex-wrap:wrap;margin-bottom:15px}
.aio-topics-head h2{font-size:clamp(1.25rem,2.1vw,1.75rem);margin:0 0 5px;color:#fff}
.aio-topics-head p{margin:0}.aio-topics-subtitle{color:rgb(var(--orbit-p4-muted, 185 214 223));max-width:680px;font-size:.9rem}
.aio-topic-all{cursor:pointer;border:1px solid rgb(var(--orbit-p4-line-strong, 81 182 201));background:rgb(var(--orbit-p4-raised, 18 61 76));color:rgb(var(--orbit-p4-text, 229 252 255));padding:10px 15px;border-radius:10px;font-weight:800;min-height:44px}
.aio-topics-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(158px,1fr));gap:10px}
.aio-topic-card{cursor:pointer;min-height:120px;border:1px solid rgb(var(--orbit-p4-line, 56 104 121));background:linear-gradient(140deg,rgb(var(--orbit-p4-raised, 18 57 73)),rgb(var(--orbit-p4-panel, 13 43 58)));color:#f4fbfe;border-radius:14px;padding:14px;display:flex;flex-direction:column;align-items:flex-start;gap:4px;text-align:left;transition:border-color .15s,transform .15s}
.aio-topic-card:hover,.aio-topic-card:focus-visible{border-color:#77e6e6;transform:translateY(-2px)}
.aio-topic-card.is-active{border-color:#85f5d9;background:rgb(var(--orbit-p4-control, 24 76 87));box-shadow:inset 0 0 0 1px #7bf3dc}
.aio-topic-icon{font-size:1.5rem}.aio-topic-label{font-size:.91rem;font-weight:800;line-height:1.25}.aio-topic-count{font-size:.76rem;color:rgb(var(--orbit-p4-muted, 166 204 218));margin-top:auto}
.aio-topic-filters{border-top:1px solid rgb(var(--orbit-p4-line, 49 93 109));margin-top:16px;padding-top:14px;color:rgb(var(--orbit-p4-text, 223 247 251))}
.aio-topic-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr));gap:11px;margin:12px 0}
.aio-topic-field{display:flex;flex-direction:column;gap:5px;font-size:.83rem;font-weight:750;color:rgb(var(--orbit-p4-text, 210 239 245));min-width:0}
.aio-topic-field[hidden]{display:none!important}
.aio-topic-field select{width:100%;min-width:0;min-height:44px;color:#f1fbfd;background:rgb(var(--orbit-p4-panel, 8 37 49));border:1px solid rgb(var(--orbit-p4-line-strong, 68 129 149));border-radius:10px;padding:8px 12px;font:inherit}
.aio-topic-pill{display:inline-block;font-size:.74rem;font-weight:700;line-height:1.3;padding:4px 9px;background:rgb(var(--orbit-p4-control, 18 79 98));color:rgb(var(--orbit-p4-text, 219 250 255));border:1px solid rgb(var(--orbit-p4-line-strong, 72 138 160));border-radius:99px;margin-right:5px;margin-top:4px}
.aio-topic-market{background:#34502a;border-color:#7daa66;color:#e5ffd7}
[data-compose-form] .aio-topic-fields,.aio-edit-dialog-v1 .aio-topic-fields,.community-admin-edit-dialog .aio-topic-fields{grid-column:1/-1;border:1px solid rgb(var(--orbit-p4-line, 43 101 118));border-radius:12px;padding:12px;background:rgb(var(--orbit-p4-panel, 8 45 61) / 0.4)}
@media(max-width:720px){.aio-topics-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.aio-topic-card{min-height:108px;padding:11px}.aio-topics-head{align-items:flex-start}.aio-topic-fields{grid-template-columns:1fr 1fr}}
@media(max-width:400px){.aio-topic-fields{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){.aio-topic-card{transition:none}.aio-topic-card:hover{transform:none}}

.aio-topic-market-warning{grid-column:1/-1;margin:0;padding:11px 12px;border-radius:9px;border:1px solid #977046;background:#322b20;color:#ffebce;font-size:.81rem;line-height:1.5}
.aio-topic-market-warning[hidden]{display:none!important}

.aio-topics-v4 .aio-topic-groups{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.aio-topic-group{min-width:0}
.aio-topic-group-title{margin:0 0 .45rem;font-size:1rem}
.aio-topic-group-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.aio-topic-group-grid .aio-topic-card{min-height:84px}
a.aio-topic-pill:hover,a.aio-topic-pill:focus-visible{text-decoration:underline}
@media(max-width:720px){.aio-topics-v4 .aio-topic-groups{grid-template-columns:minmax(0,1fr);gap:13px}}

/* AIO Topics V4.1 — zwijany wybor dzialu, widoczne wyniki po kliknieciu. */
.aio-topics-actions{display:flex;flex-wrap:wrap;gap:9px;align-items:center}
.aio-topic-change{cursor:pointer;border:1px solid rgb(var(--orbit-p4-line-strong, 127 187 182));background:rgb(var(--orbit-p4-control, 30 80 87));color:#f3ffff;padding:10px 15px;border-radius:10px;font-weight:800;min-height:44px}
.aio-topic-change[hidden],.aio-topics-grid[hidden]{display:none!important}
.aio-topic-change:focus-visible,.aio-topic-all:focus-visible{outline:2px solid #a9faf2;outline-offset:3px}
.aio-topics-v4.aio-topics-compact{padding:clamp(12px,1.5vw,18px)}
.aio-topics-v4.aio-topics-compact .aio-topics-head{margin-bottom:6px}
.aio-topics-v4.aio-topics-compact .aio-topics-subtitle{display:none}
.aio-topics-v4.aio-topics-compact .aio-topic-filters{margin-top:7px;padding-top:9px}
body[data-community-page="feed"] .community-main [data-community-feed]{scroll-margin-top:90px}
@media(max-width:600px){.aio-topics-v4.aio-topics-compact .aio-topics-head h2{font-size:1.15rem}.aio-topics-actions{width:100%}.aio-topics-actions button{flex:1}}

/* V4.2: jawny wybor dzialu, bez skokowego zwijania po wyborze. */
.community-layout,.community-main,.community-shell,.aio-topics-v4{min-width:0;max-width:100%}
.aio-topics-v4,.aio-topics-v4 *{box-sizing:border-box}
.aio-topics-v4{overflow-wrap:break-word}
.aio-topics-head{min-width:0}
.aio-topics-head>div:first-child{min-width:0;flex:1 1 220px}
.aio-topics-grid{min-width:0;width:100%;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.aio-topic-card{min-width:0;max-width:100%;min-height:92px;overflow-wrap:anywhere}
.aio-topic-all,.aio-topic-change{max-width:100%;white-space:normal;line-height:1.3}
.aio-topic-filters[hidden],.aio-topics-grid[hidden]{display:none!important}
.aio-topics-v4.aio-topics-compact .aio-topics-subtitle{display:none}
.aio-topics-v4.aio-topics-compact .aio-topics-head{margin-bottom:0}
.aio-topic-results-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;min-width:0;margin:6px 0 12px;padding:13px 16px;border:1px solid rgb(var(--orbit-p4-line, 49 92 110));border-radius:13px;background:rgb(var(--orbit-p4-panel, 11 43 58));color:#edfaff;scroll-margin-top:94px}
.aio-topic-results-copy{min-width:0;flex:1 1 170px}
.aio-topic-results-title{margin:0 0 3px;font-size:clamp(1.05rem,2.2vw,1.25rem);color:#f3fcff;overflow-wrap:anywhere}
.aio-topic-results-info{margin:0;color:rgb(var(--orbit-p4-muted, 183 212 221));font-size:.83rem;line-height:1.45}
.aio-topic-results-change{cursor:pointer;min-height:42px;padding:9px 13px;border-radius:9px;border:1px solid rgb(var(--orbit-p4-line-strong, 88 166 186));background:rgb(var(--orbit-p4-raised, 16 60 75));color:#f0fbff;font-weight:750}
.community-feed .community-empty{min-width:0;padding:25px 18px;text-align:center;border:1px dashed rgb(var(--orbit-p4-line-strong, 74 130 147));border-radius:12px;background:rgb(var(--orbit-p4-panel, 11 41 54))}
.community-feed .community-empty strong{font-size:1.07rem}
.community-feed .community-empty p{max-width:560px;margin:9px auto 0;line-height:1.55}
@media(max-width:820px){
  .aio-topics-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .aio-topics-v4{padding:14px 12px}
  .aio-topic-card{min-height:86px;padding:11px}
  .aio-topic-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:540px){
  .aio-topics-head{display:flex;flex-direction:column;align-items:stretch;gap:10px}
  .aio-topics-head h2{font-size:1.18rem;line-height:1.25}
  .aio-topics-actions{display:grid;width:100%;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .aio-topics-actions button{min-width:0;width:100%;padding:9px 7px;font-size:.8rem}
  .aio-topics-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  .aio-topic-card{min-height:79px;padding:10px 9px;gap:2px;border-radius:10px}
  .aio-topic-icon{font-size:1.2rem}
  .aio-topic-label{font-size:.79rem;line-height:1.25}
  .aio-topic-count{font-size:.7rem}
  .aio-topic-results-heading{padding:12px;gap:9px}
  .aio-topic-results-change{width:100%}
  .aio-topic-fields{grid-template-columns:1fr}
}
@media(max-width:340px){.aio-topics-grid{grid-template-columns:1fr}.aio-topic-card{min-height:64px}}


/* AIO Topics V4.3 — widoki rozdzielone, bez przesuwania katalogu nad posty. */
body[data-community-page="feed"] .aio-topics-v4[hidden],
body[data-community-page="feed"] .aio-topics-grid[hidden] {display:none!important}
body[data-community-page="feed"].aio-topic-directory-open .community-main > :not(#aio-topics-v4){display:none!important}
body[data-community-page="feed"].aio-topic-directory-open .aio-topics-v4{display:block!important}
body[data-community-page="feed"] .aio-topic-filters:not([hidden]){
  padding:13px 15px;margin:0 0 12px;border:1px solid rgb(var(--orbit-p4-line, 49 92 110));border-radius:12px;
  background:rgb(var(--orbit-p4-panel, 9 41 55));min-width:0;max-width:100%;box-sizing:border-box;
}
body[data-community-page="feed"] .aio-topic-results-heading{margin-top:0}
body[data-community-page="feed"] .aio-topics-v4 .aio-topic-card.is-active{border-color:#82e8cf}
body[data-community-page="feed"] .aio-topics-v4{width:100%;max-width:100%}

/* AIO V4.3 — usuniecie zrodla rozciagania listy wpisow na telefonie.
   1fr z domyslnym min-width:auto nie jest bezpieczne dla dlugich tresci. */
@media (max-width:980px){
  body[data-community-page="feed"] .community-layout{display:grid;grid-template-columns:minmax(0,1fr)!important}
  body[data-community-page="feed"] .community-main{display:grid;grid-template-columns:minmax(0,1fr)!important}
  body[data-community-page="feed"] .community-main > *,
  body[data-community-page="feed"] .community-sidebar,
  body[data-community-page="feed"] .community-feed{
    min-width:0!important;max-width:100%;width:100%;box-sizing:border-box;
  }
}
@media (max-width:760px){
  body[data-community-page="feed"] .community-shell,
  body[data-community-page="feed"] .community-layout,
  body[data-community-page="feed"] .community-main,
  body[data-community-page="feed"] .community-feed,
  body[data-community-page="feed"] .community-panel,
  body[data-community-page="feed"] [data-community-private-content],
  .community-post-page,.community-post-card,.community-post-content,.community-post-text{
    min-width:0!important;max-width:100%!important;box-sizing:border-box;
  }
  body[data-community-page="feed"] .community-feed,
  .community-post-page{display:grid;grid-template-columns:minmax(0,1fr)!important}
  .community-post-card{width:100%;overflow:hidden}
  .community-post-head{min-width:0;max-width:100%;flex-wrap:wrap}
  .community-post-author{min-width:0!important;flex:1 1 125px;overflow-wrap:anywhere}
  .community-post-author strong,.community-post-meta{min-width:0;max-width:100%;overflow-wrap:anywhere}
  .community-post-content{width:100%;padding-left:12px;padding-right:12px}
  .community-post-content h2,.community-post-content h3,
  .community-post-text,.community-comment-body{overflow-wrap:anywhere;word-break:break-word;white-space:normal}
  .community-post-content img,.community-post-content video,
  .community-post-content iframe,.community-comment-body img,
  .community-media-grid img{
    display:block;max-width:100%!important;height:auto;box-sizing:border-box;
  }
  .community-post-content pre,.community-comment-body pre{
    display:block;max-width:100%;overflow-x:auto;white-space:pre-wrap;overflow-wrap:anywhere;overscroll-behavior-x:contain;
  }
  .community-post-content code,.community-comment-body code{overflow-wrap:anywhere}
  .community-post-content table,.community-comment-body table{
    display:block;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;
  }
  .community-media-grid,.community-media-grid.one{min-width:0;max-width:100%;grid-template-columns:minmax(0,1fr)}
  .community-toolbar{min-width:0;width:100%;box-sizing:border-box}
  .community-toolbar input,.community-toolbar select{max-width:100%;min-width:0}
  .community-tabs,.community-post-tags,.community-post-actions{max-width:100%;min-width:0}
  .community-comment,.community-comments{min-width:0;max-width:100%;box-sizing:border-box}
  .aio-topic-results-heading{width:100%;min-width:0;max-width:100%;box-sizing:border-box}
}
@media(max-width:420px){
  body[data-community-page="feed"] .aio-topics-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  body[data-community-page="feed"] .aio-topic-results-change{min-height:44px;width:100%}
  body[data-community-page="feed"] .aio-topic-filters:not([hidden]){padding:12px}
}

/* V4.3 — ograniczenie mediów/tekstu także na tabletach i w pojedynczych postach. */
.community-post-text,.community-comment-body{min-width:0;max-width:100%;overflow-wrap:anywhere;word-break:break-word}
.community-post-text img,.community-post-text video,.community-post-text iframe,
.community-comment-body img,.community-comment-body video,.community-comment-body iframe{
  max-width:100%!important;height:auto;box-sizing:border-box;
}
.community-post-text pre,.community-comment-body pre{
  display:block;max-width:100%;overflow-x:auto;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;
}
.community-post-text table,.community-comment-body table{
  display:block;max-width:100%;overflow-x:auto;
}
.community-post-author strong,.community-post-meta{overflow-wrap:anywhere;min-width:0}
